
public class CircularLinkedList {

	Node head,tail;
	Node currentNode;
	
	public void addAtTail(Node x)
	{
		if(head == null){			
			currentNode = head = tail = x;
			head.setNext(head);			
			return;
		}
		tail.setNext(x);
		tail = x;
		x.setNext(head);		
	}
	public void deleteAtHead()
	{
		if(head == tail){
			currentNode = head = tail = null;
			return;
		}
		tail.setNext(head.getNext());
		head = head.getNext();		
	}
	public Node getHead()
	{
		return this.head;
	}
	public Node getTail()
	{
		return this.tail;
	}	
	public Node getNextNode()
	{
		currentNode = currentNode.getNext();
		return currentNode;
	}
	
}
